package homeworke.question19;

/**
 * Author：毕龙
 * Date: 2024/4/18 19:55
 */
public class Test20 {
    public static void main(String[] args) {
        Shape[] shapes = new Shape[3];
        shapes[0] = new Circle(2);
        shapes[1] = new Rect(1,2);
        shapes[2] = new Square(2);
        computer(shapes);

    }

    public static void computer(Shape[] shapes){
        for (int i = 0; i < shapes.length; i++) {
            System.out.println(shapes[i]+"面积："+shapes[i].area());
            System.out.println(shapes[i]+"周长："+shapes[i].girth());
        }
    }


    public static Shape getShape(int i){
        if(i==0) return new Circle(1);
        if(i ==1) return new Rect(3,2);
        if(i == 2)return new Square(2);
        return null;
    }
}
